/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.ChangeSet;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Change Set</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ChangeSetImpl#getAddedLines <em>Added Lines</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ChangeSetImpl#getDeletedLines <em>Deleted Lines</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.ChangeSetImpl#getIntervalDefinition <em>Interval Definition</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ChangeSetImpl extends EObjectImpl implements ChangeSet {
	/**
	 * The cached value of the '{@link #getAddedLines() <em>Added Lines</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAddedLines()
	 * @generated
	 * @ordered
	 */
	protected EList<String> addedLines;

	/**
	 * The cached value of the '{@link #getDeletedLines() <em>Deleted Lines</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeletedLines()
	 * @generated
	 * @ordered
	 */
	protected EList<String> deletedLines;

	/**
	 * The default value of the '{@link #getIntervalDefinition() <em>Interval Definition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIntervalDefinition()
	 * @generated
	 * @ordered
	 */
	protected static final String INTERVAL_DEFINITION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getIntervalDefinition() <em>Interval Definition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIntervalDefinition()
	 * @generated
	 * @ordered
	 */
	protected String intervalDefinition = INTERVAL_DEFINITION_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ChangeSetImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.CHANGE_SET;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getAddedLines() {
		if (addedLines == null) {
			addedLines = new EDataTypeUniqueEList<String>(String.class, this, ModelPackage.CHANGE_SET__ADDED_LINES);
		}
		return addedLines;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getDeletedLines() {
		if (deletedLines == null) {
			deletedLines = new EDataTypeUniqueEList<String>(String.class, this, ModelPackage.CHANGE_SET__DELETED_LINES);
		}
		return deletedLines;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getIntervalDefinition() {
		return intervalDefinition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIntervalDefinition(String newIntervalDefinition) {
		String oldIntervalDefinition = intervalDefinition;
		intervalDefinition = newIntervalDefinition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.CHANGE_SET__INTERVAL_DEFINITION, oldIntervalDefinition, intervalDefinition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.CHANGE_SET__ADDED_LINES:
				return getAddedLines();
			case ModelPackage.CHANGE_SET__DELETED_LINES:
				return getDeletedLines();
			case ModelPackage.CHANGE_SET__INTERVAL_DEFINITION:
				return getIntervalDefinition();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.CHANGE_SET__ADDED_LINES:
				getAddedLines().clear();
				getAddedLines().addAll((Collection<? extends String>)newValue);
				return;
			case ModelPackage.CHANGE_SET__DELETED_LINES:
				getDeletedLines().clear();
				getDeletedLines().addAll((Collection<? extends String>)newValue);
				return;
			case ModelPackage.CHANGE_SET__INTERVAL_DEFINITION:
				setIntervalDefinition((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.CHANGE_SET__ADDED_LINES:
				getAddedLines().clear();
				return;
			case ModelPackage.CHANGE_SET__DELETED_LINES:
				getDeletedLines().clear();
				return;
			case ModelPackage.CHANGE_SET__INTERVAL_DEFINITION:
				setIntervalDefinition(INTERVAL_DEFINITION_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.CHANGE_SET__ADDED_LINES:
				return addedLines != null && !addedLines.isEmpty();
			case ModelPackage.CHANGE_SET__DELETED_LINES:
				return deletedLines != null && !deletedLines.isEmpty();
			case ModelPackage.CHANGE_SET__INTERVAL_DEFINITION:
				return INTERVAL_DEFINITION_EDEFAULT == null ? intervalDefinition != null : !INTERVAL_DEFINITION_EDEFAULT.equals(intervalDefinition);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (addedLines: ");
		result.append(addedLines);
		result.append(", deletedLines: ");
		result.append(deletedLines);
		result.append(", intervalDefinition: ");
		result.append(intervalDefinition);
		result.append(')');
		return result.toString();
	}

} //ChangeSetImpl
